package
{
	public class stack
	{
		public var size : int;
		private var stiva : node;
		public function stack()
		{
			size=0;
		}
		
		public function pop():void
		{
			if(size==0)
				return ;
			
			stiva=stiva.next;
			
			size--;
		}
		
		public function push(x:Object):void
		{
			var aux : node = new node();
			
			aux.next=stiva;
			aux.data=x;
			
			stiva=aux;
			
			size++;
		}
		public function top():Object
		{
			return stiva.data;
		}
		
		public function isEmpty():Boolean
		{
			return size==0;
		}
	}
}